Populate windowMinutes for MiMo and StepFun monthly windows (#2431) - #2526
Populate windowMinutes for MiMo and StepFun monthly windows (#2431)#2526LeoLin990405 wants to merge 1 commit into
Conversation
…#2431) MiMo's monthly token quota and StepFun's monthly credit pool built their primary RateWindow with windowMinutes = nil, so `planUtilizationSeriesSamples` skipped them — meaning those cards get neither the plan-utilization history chart nor the predictive pace forecast that Codex/Claude cards show. This brings them to parity, mirroring steipete#2514 (which did the same for Zai/Kimi/Grok/ Antigravity). - MiMo: token window carries `monthlyWindowSentinelMinutes` when `planPeriodEnd` is present (a real reset to project against); nil otherwise. - StepFun: the credit window carries it when `creditResetTime` is present. Verified live: a StepFun credit-plan account now reports the credit window with windowMinutes 43200 (reset ~1 month out). Tests cover both providers, including the no-reset case that keeps windowMinutes nil. Refs steipete#2431.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1928af5a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Codex/Claude windows. Only when there's a real period end to reset against. | ||
| let windowMinutes = self.planPeriodEnd == nil | ||
| ? nil | ||
| : ProviderPaceCapability.monthlyWindowSentinelMinutes |
There was a problem hiding this comment.
Route monthly windows through history and card pace
Setting the sentinel here (and in the analogous StepFun change) still does not enable either advertised card feature: UsageStore.planUtilizationSeriesSamples routes generic providers only through exact 300/10080-minute session-equivalent windows, so a lone 43200-minute primary produces no history samples, while both provider descriptors retain the default .unsupported pace capability, causing resetWindowPaceDetail to return nil. Add explicit monthly sampling and .calendarMonthResetWindow capabilities for MiMo and StepFun, with a model-seam test that verifies the history and pace output rather than only the snapshot field.
AGENTS.md reference: AGENTS.md:L25-L27
Useful? React with 👍 / 👎.
| let creditWindowMinutes = self.creditResetTime == nil | ||
| ? nil | ||
| : ProviderPaceCapability.monthlyWindowSentinelMinutes |
There was a problem hiding this comment.
Reject zero StepFun reset timestamps
When a credit-plan response contains "subscription_credit_reset_time": "0" (the API's existing representation for an unconfigured reset), parsing produces a non-nil Date(timeIntervalSince1970: 0), so this nil check incorrectly marks it as a real monthly window. Validate that the timestamp/reset date is positive and meaningful before assigning the monthly sentinel; otherwise downstream consumers receive a fabricated 30-day window anchored in 1970.
Useful? React with 👍 / 👎.
c1928af to
117e855
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 7:02 PM ET / 23:02 UTC. ClawSweeper reviewWhat this changesThe branch adds a monthly Merge readiness⛔ Blocked until stronger real behavior proof is added - 9 items remain This PR is still necessary, but its central claim is not implemented: adding the 30-day sentinel alone does not route MiMo or StepFun into the generic history sampler or enable their card pace capability. The unchanged head also retains the zero-reset timestamp path, and the claimed live result does not include inspectable downstream history or pace output. Priority: P2 Review scores
Verification
How this fits togetherMiMo and StepFun adapters turn provider API quota responses into flowchart TD
A[Provider API quota response] --> B[MiMo and StepFun adapters]
B --> C[Rate window metadata]
C --> D[Usage history sampler]
C --> E[Card pace eligibility]
D --> F[Utilization history chart]
E --> G[Pace forecast]
F --> H[Menu card]
G --> H
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Extend the provider contract end-to-end: explicitly sample valid monthly MiMo and StepFun windows, configure their descriptors for calendar-month reset pace, reject non-positive StepFun reset times, and add model-seam coverage proving both history and pace output. Do we have a high-confidence way to reproduce the issue? Yes, from current source: create a MiMo or StepFun snapshot with a 43,200-minute primary window and inspect the generic sampling and descriptor pace gates; both exclude the advertised downstream behavior. Is this the best way to solve the issue? No. Assigning the sentinel is necessary metadata but not sufficient; the narrow maintainable repair must also add explicit monthly history sampling, calendar-month pace capability, timestamp validation, and model-seam tests. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8ef86077e70a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
Summary
Companion to #2514 (#2431). MiMo's monthly token quota and StepFun's monthly credit pool build their primary
RateWindowwithwindowMinutes = nil.planUtilizationSeriesSamplesrequires a window withwindowMinutes, so those two cards get neither the plan-utilization history chart nor the predictive pace forecast that the Codex/Claude cards show — a real info-density gap.Changes
MiMoUsageSnapshot): the monthly token-quota window carriesProviderPaceCapability.monthlyWindowSentinelMinuteswhenplanPeriodEndis present (a real reset to project against), andnilotherwise.StepFunUsageFetcher): the credit-pool window carries it whencreditResetTimeis present (otherwise the pace projection would be meaningless).Both are gated on a real reset date, so no window is fabricated for an account without one.
Verification
swift test --filter "MiMo|StepFun"— 115 passed, including new cases: StepFun's credit window now assertswindowMinutes == 43200, and MiMo asserts43200with a period end andnilwithout one.swiftlint --strict— 0 violations; SwiftFormat — clean.windowMinutes: 43200(reset ≈ 1 month out) — it now feeds the history + pace forecast. (MiMo verified by construction; the account under test has no active plan period to exercise it live.)Refs #2431.